#ifndef __WINDOWSAPP_H__
#define __WINDOWSAPP_H__

#include "App/AppBase.h"

namespace RayFrame
{
  class WindowsSimpleFrame;

  /// App with a simple single window
  class DLL_DECLARE WindowsApp: public AppBase
  {
  public:
    WindowsApp(void);
    ~WindowsApp(void);

    virtual void InitApp();
    virtual FrameBase* InitFrame();
    virtual void SetInitParams(HINSTANCE hThisInst, HINSTANCE hLastInst, LPSTR
      lpszCmdLine, int nCmdShow);
    virtual void StartLoop();
    virtual void Exit();

    typedef int (__stdcall * WindowsEventCallback)(void *wnd, unsigned int msg, unsigned int _W64 wParam, int _W64 lParam);
    typedef std::vector<WindowsEventCallback> VecCallback;

    void RegisterWindowsEventCallback(WindowsEventCallback);
    HINSTANCE GetInstance(){ return m_inst; };

    VecCallback& GetCallbacks(){ return m_eventCallbacks; }
  protected:
    HINSTANCE m_inst;
    VecCallback m_eventCallbacks;
  };

  extern DLL_DECLARE WindowsApp *g_winApp;

  class DLL_DECLARE WindowsSimpleFrame: public FrameBase
  {
  protected:
    virtual void internalCreate();
    virtual void internalDestroy();
  protected:
    HWND  m_hwnd;
    HDC   m_hdc;
    HGLRC m_hrc;
  public:
    WindowsSimpleFrame();
    WindowsSimpleFrame(glm::vec2 position, glm::vec2 size, STRING caption);

    HWND GetHWnd(){ return m_hwnd; };

    virtual void SwapBuffer();
  };
}

#endif
